import org.junit.jupiter.api.Test;

import java.util.Random;

import static org.junit.jupiter.api.Assertions.assertTrue;

class MaxHeapTest {
  private final int SIZE = 1000000;
  private final int BOUND = 1000000;
  private final Random random = new Random();

  @Test
  void HeapTest() {
    MaxHeap<Integer> heap = new MaxHeap<>(SIZE);
    for (int i = 0; i < SIZE; i++) heap.add(random.nextInt(BOUND));
    int pre = Integer.MAX_VALUE;
    while (!heap.isEmpty()) {
      int curr = heap.remove();
      assertTrue(curr <= pre);
      pre = curr;
    }
  }
}
